<template>
	<view>
		<view style="position: fixed;right: 5px;bottom:80px;opacity: 0.6;" @tap="open()">
			<uv-icon customStyle="background-color:#7a7b7c;color:#FFFFFF;padding:5px 5px;border-radius: 500rpx;"
				custom-prefix="icon icon-jiaoya" :size="35"></uv-icon>
		</view>
		<uv-popup ref="popupHistory">
	
			<view style="height: 400px;background-color: #f2f2f2;overflow-y: scroll;">
				<uv-notice-bar speed="50" duration="5000" icon="info-circle" color="#a0a0a0" bgColor="#f2f2f2"
					:text="noticeText" direction="column"></uv-notice-bar>

				<view class="css-margin-lr-sm css-margin-bottom css-padding css-bg-white css-radius-xl"
					v-for="(item,index) in listData" :key="index">

					<view class="css-flex-x css-align-center css-justify-between css-column-gap">
						<view class="css-flex-twice">
							<view class="css-flex-x css-align-center">
								
							</view>
						</view>
						<view class="css-flex-sub">
							<uv-button type="error" text="去办理" @click="dumpPage('pages/goods/buy',{id:item.id,goodsId:item.goods_id,number:item.number,fromApi:item.from_api,province:item.province,city:item.city,preMoney:item.pre_money,price:item.sale_price
})"></uv-button>
						</view>
					</view>
					<view class="css-flex-x css-align-center css-margin-top-sm">
						<text>{{item.city}}</text>
						<text>{{item.operator}}</text>
						<view class="css-bg-yellow-light css-radius uv-border css-margin-left"
							v-if="!isEmpty(item.symbol)">
							<text class="css-padding-sm">{{item.symbol}}</text>
						</view>
					</view>
					<view class="css-flex-x css-align-center css-justify-between css-margin-top-sm">
						<view>
							<view>
								<text class="css-text-red css-text-xl css-text-bold">￥{{item.sale_price || 0}}</text>
							</view>
							<view v-if="!isEmpty(item.pre_money)">
								<text class="css-text-gray css-text-lg">(话费:￥{{item.pre_money}} 元需另存)</text>
							</view>
						</view>
						<view>
							<uv-icon name="close-circle-fill" size="18" color="#C0C0C0"
								></uv-icon>
						</view>
					</view>
				</view>
			</view>
		</uv-popup>
	</view>
</template>

<script>
	export default {
		name: "cu-history",
		props: {
			type: {
				type: [String, Number],
				default: 0
			}
		},
		data() {
			return {
				nowType: 0,
				listData: [],
				noticeText: ""
			}
		},
		created() {
			this.nowType = parseInt(this.type);
		},
		methods: {
			isEmpty(item) {
				return uni.$uv.test.empty(item)
			},
			getProperty(obj, key) {
				return uni.$uv.getProperty(obj, key);
			},
			dumpPage(page, params, type) {
				uni.$my.dumpPage(page, params, type)
			}
			
		}
	}
</script>

<style lang="scss" scoped>
	.tabBoxSelected {
		border-radius: 20px 0px 20px 0px;
		border: 1px solid #d9d9d9;
		background-color: #ff3333;
		color: #ffffff;
	}
</style>